package com.lupengning.payment.controller;

import com.lupengning.payment.entity.Product;
import com.lupengning.payment.service.ProductService;
import com.lupengning.payment.vo.R;
import io.swagger.annotations.Api;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lupengning
 * @version 1.0
 * @description:
 * @date 2021/12/26 22:25
 */
@Slf4j
@Api(tags = "商品管理")
@RestController
@RequestMapping("/api/product")
@CrossOrigin
public class ProductController {

  @Autowired
  private ProductService productService;

  @GetMapping("/list")
  public R getProductList() {
    List<Product> productList = productService.list();
    return R.ok().data("productList", productList);
  }
}
